package top.revery.task.dto;


import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import top.revery.api.entity.task.BaseTask;

import java.util.List;

/**
 * @author denghao
 * @title
 * @package
 * @date 2019/12/14 9:33
 */
public interface TaskDto extends JpaRepository<BaseTask,Long>,JpaSpecificationExecutor<BaseTask>{
    BaseTask findByTaskNumber(String taskNumber);
    @Query(value = "select count(t) from BaseTask t where companyId=?1 and t.status=0 and t.isfo=1")
    Long aTask(Long id);
    @Query(value = "select count(t) from BaseTask t where companyId=?1 and t.status=1 and t.isfo=1")
    Long bTask(Long id);
    @Query(value = "select count(t) from BaseTask t where companyId=?1 and t.status=2 and t.isfo=1")
    Long cTask(Long id);
    @Query(value = "select count(t) from BaseTask t where companyId=?1 and t.status=3 and t.isfo=1")
    Long dTask(Long id);


    @Query(value = "select count(t) from BaseTask t where t.kolId=?1 and t.status=0")
    Long eTask(Long id);
    @Query(value = "select count(t) from BaseTask t where t.kolId=?1 and t.status=1")
    Long xTask(Long id);
    @Query(value = "select count(t) from BaseTask t where t.kolId=?1 and t.status=2")
    Long yTask(Long id);
    @Query(value = "select count(t) from BaseTask t where t.kolId=?1 and t.status=3")
    Long zTask(Long id);
  /*  BaseTask findByCompanyIdAndKolId(Long companyId, Long userId);*/

    List<BaseTask> findByCompanyId(long id);
}
